﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Cliente.Logica;

namespace Cliente
{
    public partial class Principal : Form
    {
        Boolean tjta = true;

        public Principal()
        {
            InitializeComponent();
        }

        public void agregar(String n) {
            if (tjta)
                metodosGUI.agregar(textTjta, n, 10);
            else
                metodosGUI.agregar(textClave, n, 10);
        }

        private void Principal_Load(object sender, EventArgs e)
        {

        }

        private void labelBorrar_Click(object sender, EventArgs e)
        {
            if (tjta)
                metodosGUI.borrar(textTjta);
            else
                metodosGUI.borrar(textClave);
        }

        private void labelContinuar_Click(object sender, EventArgs e)
        {
            if (tjta)
            {
                if (!metodosGUI.validarTarjeta(textTjta))
                    return;
                else
                    textClave.Focus();
            }
            tjta = !tjta;
            if (tjta)
            {
                if (!metodosGUI.validarClave(textClave))
                {
                    tjta = !tjta;
                    return;
                }
                metodosGUI.validarCoincidencia(this, textTjta.Text, textClave.Text);
            }
            
        }

        private void labelCancelar_Click(object sender, EventArgs e)
        {
            metodosGUI.reset(this);
        }

        private void num1_Click(object sender, EventArgs e)
        {
            agregar("1");
        }

        private void num2_Click(object sender, EventArgs e)
        {
            agregar("2");
        }

        private void num3_Click(object sender, EventArgs e)
        {
            agregar("3");
        }

        private void num4_Click(object sender, EventArgs e)
        {
            agregar("4");
        }

        private void num5_Click(object sender, EventArgs e)
        {
            agregar("5");
        }

        private void num6_Click(object sender, EventArgs e)
        {
            agregar("6");
        }

        private void num7_Click(object sender, EventArgs e)
        {
            agregar("7");
        }

        private void num8_Click(object sender, EventArgs e)
        {
            agregar("8");
        }

        private void num9_Click(object sender, EventArgs e)
        {
            agregar("9");
        }

        private void num0_Click(object sender, EventArgs e)
        {
            agregar("0");
        }

        private void Principal_Load_1(object sender, EventArgs e)
        {

        }


    }
}
